package com.watson.mvcdemo.demo;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: TODO
 * @Author watson
 * @Date 2022/8/5 16:55
 * @Version 1.0
 */
public class de {
    public static void main(String[] args) {
        List<DemoNode> list = new ArrayList<>();
        for (int i = 1; i < 10; i++) {
            DemoNode demoNode = new DemoNode();
            demoNode.setId(i);
            demoNode.setParentId(i - 1);
            list.add(demoNode);
        }
        for (int i = 10; i < 30; i++) {
            DemoNode demoNode = new DemoNode();
            if (i == 10) {
                demoNode.setParentId(0);
            } else {
                demoNode.setParentId(i - 1);
            }
            demoNode.setId(i);
            list.add(demoNode);
        }
        List<DemoNode> bulid = TreeUtil.bulid(list, 0);
        System.out.println(bulid);
        List<DemoNode> tree = TreeUtil.bulid(list, 0);
        System.out.println(tree);



    }
}
